<style>
    @import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700);

    @font-face {
        font-family: 'FontAwesome';
        font-style: normal;
        font-weight: normal;
        src: url('/fonts/fontawesome-webfont.ttf');
        url('/fonts/fontawesome-webfont.ttf') format('truetype'),
    }

    .fontawesome-user:before {
        content: "\f007"
    }


    .fontawesome-lock:before {
        content: "\f023"
    }

    [class*="fontawesome-"]:before {
        font-family: 'FontAwesome', sans-serif;
    }

    * {
        box-sizing: border-box;
    }

    html {
        height: 100%;
    }

    body {
        background-color: #2c3338;
        color: #606468;
        font: 400 0.875rem/1.5 "Open Sans", sans-serif;
        margin: 0;
        min-height: 100%;
    }

    a {
        color: #eee;
        outline: 0;
        text-decoration: none;
    }

    a:focus, a:hover {
        text-decoration: underline;
    }

    input {
        border: 0;
        color: inherit;
        font: inherit;
        margin: 0;
        outline: 0;
        padding: 0;
        -webkit-transition: background-color .3s;
        transition: background-color .3s;
    }

    .site__container {
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
        padding: 3rem 0;
    }

    .form input[type="password"], .form input[type="text"], .form input[type="button"] {
        width: 100%;
    }

    .form--login {
        color: #606468;
    }

    .form--login label,
    .form--login input[type="text"],
    .form--login input[type="password"],
    .form--login input[type="button"] {
        border-radius: 0.25rem;
        padding: 1rem;
    }

    .form--login label {
        background-color: #363b41;
        border-bottom-right-radius: 0;
        border-top-right-radius: 0;
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .form--login input[type="text"], .form--login input[type="password"] {
        background-color: #3b4148;
        border-bottom-left-radius: 0;
        border-top-left-radius: 0;
    }

    .form--login input[type="text"]:focus, .form--login input[type="text"]:hover, .form--login input[type="password"]:focus, .form--login input[type="password"]:hover {
        background-color: #434A52;
    }

    .form--login input[type="button"] {
        background-color: #ea4c88;
        color: #eee;
        font-weight: bold;
        text-transform: uppercase;
    }

    .form--login input[type="button"]:focus, .form--login input[type="button"]:hover {
        background-color: #d44179;
    }

    .form__field {
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        margin-bottom: 1rem;
    }

    .form__input {
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
    }

    .align {
        -webkit-box-align: center;
        -webkit-align-items: center;
        -ms-flex-align: center;
        align-items: center;
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-orient: horizontal;
        -webkit-box-direction: normal;
        -webkit-flex-direction: row;
        -ms-flex-direction: row;
        flex-direction: row;
    }

    .hidden {
        border: 0;
        clip: rect(0 0 0 0);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        width: 1px;
    }

    .text--center {
        text-align: center;
    }

    .grid__container {
        margin: 0 auto;
        max-width: 20rem;
        width: 90%;
    }

    .grid__title {
        text-align: center;
        transform: translateY(-100%);
    }

</style>
<body class="align">

<div class="site__container">
    <h1 class="grid__title">Welcome home, Mr.President !</h1>
    <div class="grid__container">

        <form action="" method="post" class="form form--login">

            <div class="form__field">
                <label class="fontawesome-user" for="login__username"><span class="hidden">Username</span></label>
                <input id="login__username" type="text" class="form__input" placeholder="Username" required>
            </div>

            <div class="form__field">
                <label class="fontawesome-lock" for="login__password"><span class="hidden">Password</span></label>
                <input id="login__password" type="password" class="form__input" placeholder="Password" required>
            </div>

            <div class="form__field">
                <input id="signIn" type="button" value="Sign In">
            </div>

        </form>

        <p class="text--center"></p>

    </div>

</div>

</body>
<script src="//cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>

<script>
    $(function () {
        $('#signIn').on('click', function () {
            $.ajax({
                url: '/login',
                data: {
                    username: $('#login__username').val(),
                    password: $('#login__password').val()
                },
                type: 'POST',
                dataType: 'json'
            }).done(function (data) {
                if (data.success) {
                    window.location.href = data.redirectUrl;
                } else {
                    $('.text--center').text(data.message);
                }
            }).fail(function (err) {
                console.log(err.message)
            })
        });
        $(document).on('keyup', function (e) {
            if (e.keyCode === 13) {
                $('#signIn').trigger('click');
            }
        })
    })
</script>